package test.designmode.factory;

import java.util.concurrent.ThreadFactory;

/**
 * 抽象工厂具备的三大特点:
 * 1. 接口或者抽象类
 * 2. 创建实例
 * 3. 抽象方法
 */
public class AbstractFactoryDemo {
    public static void main(String[] args) {
        // ThreadFactory就是典型的抽象工厂
        ThreadFactory factory = Thread::new;
        Thread t1 = factory.newThread(() -> System.out.println(123));
        Thread t2 = factory.newThread(() -> System.out.println(345));
        t1.start();
        t2.start();
    }
}
